package cn.bblocks.cacheTest.suport.annotations;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import static cn.bblocks.cacheTest.suport.annotations.Dao.IgnoreValue.NONE;


/**
 * @program:
 * @author: captain.ma
 * @date: 2018-11-21
 * @since: 1.0.0.0
 */
@AllArgsConstructor
@Getter
public class ResolveDao {
    @Getter
    @Setter
    public static class DAO {
        final String propertyName;
        final Dao.IgnoreValue ignore;
        final Dao.Symbol symbol;
        //太特殊


        DAO(String propertyName, Dao.IgnoreValue ignore, Dao.Symbol symbol) {
            this.propertyName = propertyName;
            this.ignore = ignore;
            this.symbol = symbol;

        }
    }

    private final String symbol;
    private final String propertyNameKey;
    private final String propertyNameValue;
    private final boolean ignore;
    private final Object value;
    public static DAO of(Dao dao) {
        if (dao == null) {
            return new DAO("", NONE, Dao.Symbol.EQ);
        }
        return new DAO(dao.value(), dao.ignore(), dao.symbol());
    }


}
